//
//  MKTChatViewController.m
//  MKUITestApp
//
//  Created by 苏尚进 on 2021/7/8.
//  Copyright © 2021 moon. All rights reserved.
//

#import "MKTChatViewController.h"
#import <MKUI/MKUI.h>
#import "MKTChatHeaders.h"

@interface MKTChatViewController ()
@property(nonatomic,strong) MKUITableView *tableView;
@end

@implementation MKTChatViewController
+ (MKTFuncItem *)funcItem{
    return [MKTFuncItem funcWithName:@"聊天" viewControllerClass:self];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableView = [[MKUITableView alloc] initWithFrame:self.view.frame style:(UITableViewStylePlain)];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.tableView mk_hiddenFooterAreaSeparators];
    [self.view addSubview:self.tableView];
    [self __reloadData];
}
- (void)viewDidLayoutSubviews{
    [super viewDidLayoutSubviews];
    CGRect bounds = self.safeBounds;
    
    CGRect oldFame = self.tableView.frame;
    self.tableView.frame = bounds;
    if(!CGRectEqualToRect(oldFame, self.tableView.frame)){
        dispatch_async(dispatch_get_main_queue(), ^{
            [self.tableView.model reloadTableViewData];
        });
    }
}
- (void)__reloadData{
    [self.tableView.model removeAllSectionModels];
    MKTChatUser *me = [[MKTChatUser alloc] init];
    me.name = @"发送者1";
    me.picImage = [UIImage imageNamed:@"app-icon-1.png"];
    
    MKTChatUser *other = [[MKTChatUser alloc] init];
    other.name = @"对方1";
    other.picImage = [UIImage imageNamed:@"app-icon-2.png"];
    
    NSInteger repeat = 1;
    
//    MKTChatMsgText
    {
        MKTChatMsgText *msg = [[MKTChatMsgText alloc] init];
        msg.text = @"1、那是最美好的时代，那是最糟糕的时代。\n2、那是智慧的年头，那是愚昧的年头。\n3、那是信仰的时期，那是怀疑的时期。\n4、那是光明的季节，那是黑暗的季节。\n5、那是希望的春天，那是失望的冬天。\n6、我们全都在直奔天堂，我们全都在直奔相反的方向";
        msg.senderType = MKTChatMsgSenderTypeMine;
        msg.sender = me;
        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgTextTVCellMine class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    {
        MKTChatMsgText *msg = [[MKTChatMsgText alloc] init];
//        msg.text = @"1、那是最美好的时代，那是最糟糕的时代。2、那是智慧的年头，那是愚昧的年头。3、那是信仰的时期，那是怀疑的时期。4、那是光明的季节，那是黑暗的季节。5、那是希望的春天，那是失望的冬天。6、我们全都在直奔天堂，我们全都在直奔相反的方向";
        msg.senderType = MKTChatMsgSenderTypeMine;
        msg.sender = me;
        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgTextTVCellMine class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    {
        MKTChatMsgText *msg = [[MKTChatMsgText alloc] init];
        msg.text = @"1、那是最美好的时代，那是最糟糕的时代。2、那是智慧的年头，那是愚昧的年头。3、那是信仰的时期，那是怀疑的时期。4、那是光明的季节，那是黑暗的季节。5、那是希望的春天，那是失望的冬天。6、我们全都在直奔天堂，我们全都在直奔相反的方向";
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;
        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgTextTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    //MKTChatMsgButtonList
    {
        MKTChatMsgButtonList *msg = [[MKTChatMsgButtonList alloc] init];
        msg.text = @"寂寞深闺，柔肠一寸愁千缕。惜春春去。\n几点催花雨。倚遍阑干，只是无情绪。人何处。连天衰草，望断归来路。";
        msg.btnlist = @[
            [MKTChatLink linkWithTitle:@"李清照" url:@"https://www.baidu.com"],
        ];
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;
        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgButtonListTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    {
        MKTChatMsgButtonList *msg = [[MKTChatMsgButtonList alloc] init];
        msg.text = @"寂寞深闺，柔肠一寸愁千缕。惜春春去。几点催花雨。倚遍阑干，只是无情绪。人何处。连天衰草，望断归来路。";
        msg.btnlist = @[
            [MKTChatLink linkWithTitle:@"李清照" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"临江仙·梅" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"多丽·咏白菊" url:@"https://www.baidu.com"],
        ];
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;
        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgButtonListTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    //MKTChatMsgMultiItem
    {

        MKTChatMsgMultiItem *msg = [[MKTChatMsgMultiItem alloc] init];
        msg.title = @"萧条庭院，又斜风细雨，重门须闭。宠柳娇花寒食近，种种恼人天气。险韵诗成，扶头酒醒，别是闲滋味。征鸿过尽，万千心事难寄。";
        msg.itemslist = @[
            [MKTChatItem_1 itemWithText:@"楼上几日春寒，帘垂四面，玉阑干慵倚。"],
            [[MKTChatItem_0 alloc] init],
            [MKTChatItem_1 itemWithText:@"被冷香消新梦觉，不许愁人不起。"],
            [MKTChatItem_Unknow unknowItem],
        ];
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;

        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgMultiItemTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    //MKTChatMsgMultiItemList
    {
        MKTChatMsgMultiItemList *msg = [[MKTChatMsgMultiItemList alloc] init];
        msg.title = @"昨天夜里北斗星的斗柄转向东方，今天早晨新的一年又开始了。";
        NSMutableArray<MKTChatMsgMultiItemTab *> *itemslist = [[NSMutableArray alloc] init];
        {
            MKTChatMsgMultiItemTab *tab = [[MKTChatMsgMultiItemTab alloc] init];
            tab.title = @"田家元日";
            tab.subtitle = [MKTChatLabelValue labelValueWithText:@"孟浩然" style:(MKTChatLabelValueStyleWarning)];
            tab.itemslist = @[
                [MKTChatItem_1 itemWithText:@"昨夜斗回北，今朝岁起东。"],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_1 itemWithText:@"我年已强仕，无禄尚忧农。"],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_1 itemWithText:@"桑野就耕父，荷锄随牧童。"],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_1 itemWithText:@"田家占气候，共说此年丰。"],
            ];
            [itemslist addObject:tab];
        }
        {
            MKTChatMsgMultiItemTab *tab = [[MKTChatMsgMultiItemTab alloc] init];
            tab.selected = YES;
            tab.title = @"菊花";
            tab.subtitle = tab.subtitle = [MKTChatLabelValue labelValueWithText:@"李商隐" style:(MKTChatLabelValueStyleNormal)];
            tab.itemslist = @[
                [MKTChatItem_1 itemWithText:@"暗暗淡淡紫，融融冶冶黄。陶令篱边色，罗含宅里香。"],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_1 itemWithText:@"几时禁重露，实是怯残阳。愿泛金鹦鹉，升君白玉堂。"],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_Unknow unknowItem],
            ];
            [itemslist addObject:tab];
        }
        msg.itemslist = itemslist;
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;

        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgMultiItemListTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    {
        MKTChatMsgMultiItemList *msg = [[MKTChatMsgMultiItemList alloc] init];
        msg.title = @"昨天夜里北斗星的斗柄转向东方，今天早晨新的一年又开始了。";
        NSMutableArray<MKTChatMsgMultiItemTab *> *itemslist = [[NSMutableArray alloc] init];
        {
            MKTChatMsgMultiItemTab *tab = [[MKTChatMsgMultiItemTab alloc] init];
            tab.selected = YES;
            tab.title = @"田家元日";
            tab.subtitle = [MKTChatLabelValue labelValueWithText:@"孟浩然" style:(MKTChatLabelValueStyleAccess)];
            MKTChatTextBlock *left = [MKTChatTextBlock textBlockWithTitle:@"桑野就耕父" value:[MKTChatLabelValue labelValueWithText:@"$2200.00" format:MKTChatLabelValueFormatMoney style:MKTChatLabelValueStyleNormal] subvalue:nil];
            MKTChatTextBlock *right = [MKTChatTextBlock textBlockWithTitle:@"田家占气候" value:[MKTChatLabelValue labelValueWithText:@"共说此年丰" format:MKTChatLabelValueFormatPlainText style:MKTChatLabelValueStyleWarning] subvalue:nil];
            MKTChatTextBlock *left1 = [MKTChatTextBlock textBlockWithTitle:@"桑野就耕父" value:[MKTChatLabelValue labelValueWithText:@"￥2200.00" format:MKTChatLabelValueFormatMoney style:MKTChatLabelValueStyleNormal] subvalue:[MKTChatLabelValue labelValueWithText:@"$100.00" format:MKTChatLabelValueFormatMoney style:MKTChatLabelValueStyleNormal]];
            MKTChatTextBlock *right1 = [MKTChatTextBlock textBlockWithTitle:@"田家占气候" value:[MKTChatLabelValue labelValueWithText:@"共说此年丰" format:MKTChatLabelValueFormatPlainText style:MKTChatLabelValueStyleWarning] subvalue:[MKTChatLabelValue labelValueWithText:@"$100.00" format:MKTChatLabelValueFormatMoney style:MKTChatLabelValueStyleNormal]];
            tab.itemslist = @[
                [MKTChatItem_1 itemWithText:@"昨夜斗回北，今朝岁起东。"],
                [MKTChatItem_1 itemWithText:@"我年已强仕，无禄尚忧农。"],
//                [MKTChatItem_1 itemWithText:@"桑野就耕父，荷锄随牧童。"],
//                [MKTChatItem_1 itemWithText:@"田家占气候，共说此年丰。"],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_2 itemWithLeft:left right:right],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_3 itemWithLeft:left right:right],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_5 itemWithLeft:left right:right],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_8 itemWithText:@"孟浩然" value:[MKTChatLabelValue labelValueWithText:@"￥2000.00" format:MKTChatLabelValueFormatMoney style:MKTChatLabelValueStyleNormal] subvalue:[MKTChatLabelValue labelValueWithText:@"$192.20" format:MKTChatLabelValueFormatMoney style:MKTChatLabelValueStyleWarning]],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_9 itemWithLeft:left1 right:right],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_10 itemWithLeft:left right:right1],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_11 itemWithLeft:left right:right],
            ];
            [itemslist addObject:tab];
        }
        {
            MKTChatMsgMultiItemTab *tab = [[MKTChatMsgMultiItemTab alloc] init];
            tab.title = @"菊花";
            tab.subtitle = tab.subtitle = [MKTChatLabelValue labelValueWithText:@"李商隐" style:(MKTChatLabelValueStyleNormal)];
            tab.itemslist = @[
                [MKTChatItem_1 itemWithText:@"暗暗淡淡紫，融融冶冶黄。陶令篱边色，罗含宅里香。"],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_1 itemWithText:@"几时禁重露，实是怯残阳。"],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_6 itemWithText:@"愿泛金鹦鹉，升君白玉堂。"],
            ];
            [itemslist addObject:tab];
        }
        {
            MKTChatMsgMultiItemTab *tab = [[MKTChatMsgMultiItemTab alloc] init];
            tab.title = @"离思五首·其四";
            tab.subtitle = tab.subtitle = [MKTChatLabelValue labelValueWithText:@"元稹" style:(MKTChatLabelValueStyleWarning)];
            NSArray<MKTChatLink *> *btns = @[
                [MKTChatLink linkWithTitle:@"李清照" url:@"https://www.baidu.com"],
                [MKTChatLink linkWithTitle:@"临江仙·梅" url:@"https://www.baidu.com"],
                [MKTChatLink linkWithTitle:@"多丽·咏白菊" url:@"https://www.baidu.com"],
                [MKTChatLink linkWithTitle:@"离思五首·其四" url:@"https://www.baidu.com"],
            ];
            tab.itemslist = @[
                [MKTChatItem_4 itemWithText:@"曾经沧海难为水，除却巫山不是云。取次花丛懒回顾，半缘修道半缘君。"],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_7 itemWithBtnList:btns],
            ];
            [itemslist addObject:tab];
        }
        msg.itemslist = itemslist;
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;

        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgMultiItemListTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    
    
    {
        MKTChatMsgMultiItemList *msg = [[MKTChatMsgMultiItemList alloc] init];
        msg.title = @"您的信用卡本期人民币账单剩余应还款额2,300元，最后还款日12月10日。";
        NSMutableArray<MKTChatMsgMultiItemTab *> *itemslist = [[NSMutableArray alloc] init];
        {
            MKTChatMsgMultiItemTab *tab = [[MKTChatMsgMultiItemTab alloc] init];
            tab.selected = YES;
            tab.title = @"人民币";
            tab.subtitle = [MKTChatLabelValue labelValueWithText:@"未还清" style:(MKTChatLabelValueStyleWarning)];
            MKTChatTextBlock *left1 = [MKTChatTextBlock textBlockWithTitle:@"剩余应还" value:[MKTChatLabelValue labelValueWithText:@"￥2,300.00" format:(MKTChatLabelValueFormatMoney) style:(MKTChatLabelValueStyleNormal)] subvalue:nil];
            MKTChatTextBlock *right1 = [MKTChatTextBlock textBlockWithTitle:@"最后还款日 06/10" value:[MKTChatLabelValue labelValueWithText:@"8天后到期" format:(MKTChatLabelValueFormatPlainText) style:(MKTChatLabelValueStyleNormal) hint:@"8"] subvalue:nil];
            
            MKTChatTextBlock *left2 = [MKTChatTextBlock textBlockWithTitle:@"最低还款额" value:[MKTChatLabelValue labelValueWithText:@"￥230.00" format:(MKTChatLabelValueFormatPlainText) style:(MKTChatLabelValueStyleNormal)] subvalue:nil];
            MKTChatTextBlock *right2 = [MKTChatTextBlock textBlockWithTitle:@"账单总额" value:[MKTChatLabelValue labelValueWithText:@"￥2,300.00" format:(MKTChatLabelValueFormatPlainText) style:(MKTChatLabelValueStyleNormal) hint:nil] subvalue:nil];
            NSArray<MKTChatLink *> *btns = @[
                [MKTChatLink linkWithTitle:@"本期账单明细" url:@"https://www.baidu.com"],
                [MKTChatLink linkWithTitle:@"转账还款" url:@"https://www.baidu.com"],
                [MKTChatLink linkWithTitle:@"账单分期" url:@"https://www.baidu.com"],
            ];
            tab.itemslist = @[
                [MKTChatItem_1 itemWithText:@"5月账单 04/15-05/15"],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_2 itemWithLeft:left1 right:right1],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_3 itemWithLeft:left2 right:right2],
                [MKTChatItem_7 itemWithBtnList:btns],
            ];
            [itemslist addObject:tab];
        }
        {
            MKTChatMsgMultiItemTab *tab = [[MKTChatMsgMultiItemTab alloc] init];
            tab.selected = NO;
            tab.title = @"美元";
            tab.subtitle = tab.subtitle = [MKTChatLabelValue labelValueWithText:@"无帐单" style:(MKTChatLabelValueStyleNormal)];
            tab.itemslist = @[
                [MKTChatItem_1 itemWithText:@"5月账单 04/15-05/15"],
                [[MKTChatItem_0 alloc] init],
                [MKTChatItem_4 itemWithText:@"本期无账单"],
            ];
            [itemslist addObject:tab];
        }
        msg.itemslist = itemslist;
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;

        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgMultiItemListTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    
    {

        MKTChatMsgMultiItem *msg = [[MKTChatMsgMultiItem alloc] init];
        msg.title = @"您的信用卡当前额度如下：";
        MKTChatLabelValue *left = [MKTChatLabelValue labelValueWithText:@"￥32,982.00" format:(MKTChatLabelValueFormatMoney) style:(MKTChatLabelValueStyleNormal)];
        MKTChatLabelValue *right = [MKTChatLabelValue labelValueWithText:@"$176.00" format:(MKTChatLabelValueFormatMoney) style:(MKTChatLabelValueStyleNormal)];
        
        msg.itemslist = @[
            [MKTChatItem_8 itemWithText:@"可用额度" value:left subvalue:right],
            [[MKTChatItem_0 alloc] init],
            [MKTChatItem_9 itemWithLeft:[MKTChatTextBlock textBlockWithTitle:@"固定额度" value:[MKTChatLabelValue labelValueWithText:@"￥4,600.00"] subvalue:[MKTChatLabelValue labelValueWithText:@"$267.00"]] right:[MKTChatTextBlock textBlockWithTitle:@"预借现金可用额度" value:[MKTChatLabelValue labelValueWithText:@"￥8,763.00"] subvalue:[MKTChatLabelValue labelValueWithText:@"$349.86"]]],
        ];
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;

        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgMultiItemTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    
    {

        MKTChatMsgMultiItem *msg = [[MKTChatMsgMultiItem alloc] init];
        msg.title = @"您的信用卡当前额度如下：";
        MKTChatLabelValue *left = [MKTChatLabelValue labelValueWithText:@"￥32,982.00" format:(MKTChatLabelValueFormatMoney) style:(MKTChatLabelValueStyleNormal)];
        MKTChatLabelValue *right = [MKTChatLabelValue labelValueWithText:@"$176.00" format:(MKTChatLabelValueFormatMoney) style:(MKTChatLabelValueStyleNormal)];
        
        msg.itemslist = @[
            [MKTChatItem_8 itemWithText:@"可用额度" value:left subvalue:right],
            [[MKTChatItem_0 alloc] init],
            [MKTChatItem_9 itemWithLeft:[MKTChatTextBlock textBlockWithTitle:@"固定额度" value:[MKTChatLabelValue labelValueWithText:@"￥4,600.00"] subvalue:nil] right:[MKTChatTextBlock textBlockWithTitle:@"预借现金可用额度" value:[MKTChatLabelValue labelValueWithText:@"￥8,763.00"] subvalue:nil]],
            [[MKTChatItem_0 alloc] init],
            [MKTChatItem_9 itemWithLeft:[MKTChatTextBlock textBlockWithTitle:@"临时额度" value:[MKTChatLabelValue labelValueWithText:@"￥4,600.00"] subvalue:nil] right:[MKTChatTextBlock textBlockWithTitle:@"临时额度有限期" value:[MKTChatLabelValue labelValueWithText:@"2021/05/20-2021/12/31"] subvalue:nil]]
        ];
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;

        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgMultiItemTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    
    {

        MKTChatMsgMultiItem *msg = [[MKTChatMsgMultiItem alloc] init];
        msg.title = @"您的信用卡2021年04月人民币账单详情如下：";
        MKTChatLabelValue *left = [MKTChatLabelValue labelValueWithText:@"￥32,982.00" format:(MKTChatLabelValueFormatMoney) style:(MKTChatLabelValueStyleNormal)];
        MKTChatLabelValue *right = [MKTChatLabelValue labelValueWithText:@"$176.00" format:(MKTChatLabelValueFormatMoney) style:(MKTChatLabelValueStyleNormal)];
        
        NSArray<MKTChatLink *> *btns = @[
            [MKTChatLink linkWithTitle:@"历史账单明细" url:@"https://www.baidu.com"],
        ];
        msg.itemslist = @[
            [MKTChatItem_8 itemWithText:@"4月账单 04/15-05/15" value:left subvalue:right],
            [[MKTChatItem_0 alloc] init],
            [MKTChatItem_10 itemWithLeft:[MKTChatTextBlock textBlockWithTitle:@"账单总金额" value:[MKTChatLabelValue labelValueWithText:@"￥1240.00" format:(MKTChatLabelValueFormatMoney) style:(MKTChatLabelValueStyleNormal)] subvalue:nil] right:[MKTChatTextBlock textBlockWithTitle:@"最低还款" value:[MKTChatLabelValue labelValueWithText:@"￥230"] subvalue:nil]],
            [MKTChatItem_7 itemWithBtnList:btns],
        ];
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;

        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgMultiItemTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    
    {

        MKTChatMsgMultiItem *msg = [[MKTChatMsgMultiItem alloc] init];
        msg.title = @"您的信用卡未出账单详情如下：";
        
        NSArray<MKTChatLink *> *btns = @[
            [MKTChatLink linkWithTitle:@"未出账单明细" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"消费分期" url:@"https://www.baidu.com"],
        ];
        msg.itemslist = @[
            [MKTChatItem_2 itemWithLeft:[MKTChatTextBlock textBlockWithTitle:@"未出账单消费金额" value:[MKTChatLabelValue labelValueWithText:@"￥2,300.00" format:(MKTChatLabelValueFormatMoney) style:(MKTChatLabelValueStyleNormal)] subvalue:nil] right:[MKTChatTextBlock textBlockWithTitle:@"下期账单日" value:[MKTChatLabelValue labelValueWithText:@"6月10日 12天后出账"] subvalue:nil]],
            [MKTChatItem_6 itemWithText:@"实际还款金额请以下期账单为准"],
            [MKTChatItem_7 itemWithBtnList:btns],
        ];
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;

        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgMultiItemTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }

    {
        MKTChatMsgTextButton *msg = [[MKTChatMsgTextButton alloc] init];
        msg.text = @"预借现金是指在您无需预先在信用卡中存入现金的情况下，只要设定交易密码，就可在一定额度范围之内通过取现或透支转账的方式获取资金。……";
        msg.button = [MKTChatLink linkWithTitle:@"立即办理" url:@"https://www.baidu.com"];
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = me;
        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgTextButtonTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    {
        MKTChatMsgTextButton *msg = [[MKTChatMsgTextButton alloc] init];
        msg.text = @"昨夜斗回北，";
        msg.button = [MKTChatLink linkWithTitle:@"今朝岁起东。" url:@"https://www.baidu.com"];
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;
        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgTextButtonTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    {
        MKTChatMsgLinks *msg = [[MKTChatMsgLinks alloc] init];
        msg.title = @"猜你想问";
        msg.links = @[
            [MKTChatLink linkWithTitle:@"预借现金业务介绍" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"预借现金的收费标准" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"预借现金有额度限制吗" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"预借现金业务介绍预借现金业务介绍1" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"预借现金的收费标准1" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"预借现金有额度限制吗1" url:@"https://www.baidu.com"],
            
            [MKTChatLink linkWithTitle:@"预借现金业务介绍2" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"预借现金的收费标准2" url:@"https://www.baidu.com"],
        ];
        msg.pagenum = 3;
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;
        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgLinksTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    
    {
        MKTChatMsgLinksList *msg = [[MKTChatMsgLinksList alloc] init];
        msg.title = @"常见问题";
        
        NSArray *btnlist = @[
            [MKTChatLink linkWithTitle:@"预借现金业务介绍" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"预借现金的收费标准" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"预借现金有额度限制吗" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"预借现金业务介绍预借现金业务介绍1" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"预借现金的收费标准1" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"预借现金有额度限制吗1" url:@"https://www.baidu.com"],
            
            [MKTChatLink linkWithTitle:@"预借现金业务介绍2" url:@"https://www.baidu.com"],
            [MKTChatLink linkWithTitle:@"预借现金的收费标准2" url:@"https://www.baidu.com"],
        ];
        msg.linkslist = @[
            [MKTChatLinksTab tabWithTitle:@"办卡相关" links:btnlist],
            [MKTChatLinksTab tabWithTitle:@"卡片激活" links:btnlist],
            [MKTChatLinksTab tabWithTitle:@"分期相关" links:btnlist],
            [MKTChatLinksTab tabWithTitle:@"额度相关" links:btnlist],
            [MKTChatLinksTab tabWithTitle:@"其他" links:btnlist],
        ];
        msg.pagenum = 3;
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;
        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgLinksListTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    
    {
        MKTChatMsgUnknow *msg = [[MKTChatMsgUnknow alloc] init];
        msg.senderType = MKTChatMsgSenderTypeOther;
        msg.sender = other;
        for (int i=0; i<repeat; i++) {
            MKUITableViewCellModel *cm = [[MKUITableViewCellModel alloc] init];
            cm.cellClass = [MKTChatMsgUnknowTVCellOther class];
            cm.modelValue = msg;
            [self.tableView.model addCellModel:cm];
        }
    }
    
    [self.tableView.model reloadTableViewData];
}
@end
